package com.lifl.ecogarde;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ConversionDate {

	public static String dateToString(Date d) {
		return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(d);
	}

	public static Date stringToDate(String sDate) {
		Date d = null;
		try {
			SimpleDateFormat formatter = new SimpleDateFormat(
					"yyyy-MM-dd HH:mm:ss");
			ParsePosition pos = new ParsePosition(0);
			d = formatter.parse(sDate, pos);
		} catch (RuntimeException e) {
			e.printStackTrace();
		}
		return d;
	}
}
